<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Compare elements in order to place them correctly in the heap while sifting up</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="class.splmaxheap.html">« SplMaxHeap</a></li>
      <li style="float: right;"><a href="class.splminheap.html">SplMinHeap »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="class.splmaxheap.html">SplMaxHeap</a></li>
    <li>Compare elements in order to place them correctly in the heap while sifting up</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="splmaxheap.compare" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">SplMaxHeap::compare</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.3.0, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">SplMaxHeap::compare</span> &mdash; <span class="dc-title">Compare elements in order to place them correctly in the heap while sifting up</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-splmaxheap.compare-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">protected</span> <span class="methodname"><strong>SplMaxHeap::compare</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.declarations.html#language.types.declarations.mixed" class="type mixed">mixed</a></span> <code class="parameter">$value1</code></span>, <span class="methodparam"><span class="type"><a href="language.types.declarations.html#language.types.declarations.mixed" class="type mixed">mixed</a></span> <code class="parameter">$value2</code></span>): <span class="type">int</span></div>


  <p class="para rdfs-comment">
   Compare <code class="parameter">value1</code> with <code class="parameter">value2</code>.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-splmaxheap.compare-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>
    
     <dt>
<code class="parameter">value1</code></dt>

     <dd>

      <p class="para">
       The value of the first node being compared.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">value2</code></dt>

     <dd>

      <p class="para">
       The value of the second node being compared.
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-splmaxheap.compare-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Result of the comparison, positive integer if <code class="parameter">value1</code> is greater than <code class="parameter">value2</code>, 0 if they are equal, negative integer otherwise.
  </p>
  <blockquote class="note"><p><strong class="note">注意</strong>: 
   <p class="para">
    Having multiple elements with the same value in a Heap is not recommended. They will end up in an arbitrary relative position.
   </p>
  </p></blockquote>
 </div>


</div></div></div></body></html>